package com.pansoft.kline.adapter;

import android.content.Context;

import com.efounder.recycleviewhelper.CommonAdapter;
import com.efounder.recycleviewhelper.base.ViewHolder;
import com.efounder.utils.JfResourceUtil;
import com.pansoft.kline.model.BourseDataBean;
import com.pansoft.kline.util.MarketNumberUtils;
import com.pansoft.openplanet.R;
import com.pansoft.openplanet.manager.CurrencyAndBourseManager;

import java.util.List;

/**
 * 交易所recycleview adapter
 *
 * @author yqs
 * @date 2018/11/19
 */
public class BourseRecycleViewAdapter extends CommonAdapter<BourseDataBean.DataBean.ExchangeVolumesBean> {

    private Context mContext;

    public BourseRecycleViewAdapter(Context context, int layoutId, List<BourseDataBean.DataBean.ExchangeVolumesBean> datas) {
        super(context, layoutId, datas);
        mContext = context;
    }

    @Override
    protected void convert(ViewHolder holder, BourseDataBean.DataBean.ExchangeVolumesBean exchangeVolumesBean, int position) {
        if (position == 0) {
            holder.setText(R.id.tv_index, mContext.getString(R.string.open_planet_bourse_text2));
            holder.setText(R.id.tv_name, mContext.getString(R.string.open_planet_bourse_text3));
            holder.setText(R.id.tv_amount, mContext.getString(R.string.open_planet_bourse_hours_amounts));
            holder.setTextColor(R.id.tv_index, JfResourceUtil.getSkinColor(R.color.light_text_color));
            holder.setTextColor(R.id.tv_name, JfResourceUtil.getSkinColor(R.color.light_text_color));
            holder.setTextColor(R.id.tv_amount, JfResourceUtil.getSkinColor(R.color.light_text_color));
        } else {
            holder.setText(R.id.tv_index, position + "");
            holder.setText(R.id.tv_name, exchangeVolumesBean.getSite());
//            holder.setText(R.id.tv_amount, ResStringUtil.getString(R.string.common_text_money_unit) +MarketNumberUtils.amountConversion(exchangeVolumesBean.getVolume()));
            holder.setText(R.id.tv_amount, CurrencyAndBourseManager.getNowCurrencySymbol() +MarketNumberUtils.amountConversion(exchangeVolumesBean.getVolume()));
            holder.setTextColor(R.id.tv_index, JfResourceUtil.getSkinColor(R.color.light_text_color));
            holder.setTextColor(R.id.tv_name, JfResourceUtil.getSkinColor(R.color.black_text_color));
            holder.setTextColor(R.id.tv_amount, JfResourceUtil.getSkinColor(R.color.black_text_color));
        }

    }
}
